using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Xfinity.Physics;
using System.Xml.Serialization;
using System.IO;

namespace Xfinity.GameEditor
{
    public partial class MaterialEditor : Form
    {
        public MaterialEditor()
        {
            InitializeComponent();
        }
        private Material material;

        /// <summary>
        /// 
        /// </summary>
        public Material Material
        {
            get { return material; }
            set { material = value; }
        }

        private void MaterialEditor_Load(object sender, EventArgs e)
        {
            
            material = new Material();
            propertyGrid1.SelectedObject = material;
        }
        string fileName = "";
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                SaveFileDialog d = new SaveFileDialog();
                d.Filter = "Material files|.material";
                if (d.ShowDialog()== DialogResult.OK)
                {
                    fileName = d.FileName;
                }
                
            }
            XmlSerializer s = new XmlSerializer(typeof(Material));
            s.Serialize(new FileStream(fileName, FileMode.Create), material);

        }
    }
}